package com.cxria.pattern.memento.func3

class Originator2 {

    String state = ''

    IMemento createMemento(){
        new Memento(state)
    }

    void restoreMemento(IMemento memento){
        setState(memento.state)
    }

    private class Memento implements IMemento{

        private String state = ''

        private Memento(String state) {
            this.state = state
        }

    }

}